-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
benchmark: add benchmark utility for isNativeError function #61180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
benchmark: add benchmark utility for isNativeError function #61180
Conversation
|
Review requested:
|
RafaelGSS
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not confident about how useful this benchmark is
benchmark/util/is-native-error.js
Outdated
|
|
||
| bench.start(); | ||
| for (let iteration = 0; iteration < n; iteration++) { | ||
| func(arg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is likely being optimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I tried to fix this by using more arguments and variable arguments. 5fcf423
Any recommendations? |
|
|
||
| const func = { native: util, js: types }[version].isNativeError; | ||
|
|
||
| const testArgs = [args[argument], args[argument], args[argument]]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for this? If I'm reading correctly, the elements are all equals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to provide more arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With
const testArg = testArgs[iteration % 3];
func(testArg)below, I'm still not sure I understand.
added benchmark code for isNativeError function
for: #60468 (comment)